package com.yjz.ui.tab.common;

import android.graphics.Bitmap;

import androidx.fragment.app.Fragment;

/**
 * 作用 : tab的实体类
 * 作者 : yjz
 * 时间 : 2024/9/18 13:42
 */
public class TabInfo<Color> {
    public enum TabType {
        // 图片和文字
        BITMAP_TXT,
        // 单图片
        BITMAP,
        // 文字ICON
        ICON,
        // 单文字
        TEXT
    }

    public Fragment fragment;
    public String name;
    public Bitmap defaultBitmap;
    public Bitmap selectedBitmap;
    // 字体
    public String iconFont;
    /**
     * Tips：在Java代码中直接设置iconFont字符串无效，需要定义在string.xml
     */
    public String defaultIconName;
    public String selectedIconName;
    // 默认颜色
    public Color defaultColor;
    // 选中的颜色
    public Color tintColor;
    // tab的类型
    public TabType tabType;

    public TabInfo(String name, Color tintColor, Color defaultColor) {
        this.name = name;
        this.tintColor = tintColor;
        this.defaultColor = defaultColor;
        this.tabType = TabType.TEXT;
    }

    public TabInfo(String name, Bitmap defaultBitmap, Bitmap selectedBitmap) {
        this.name = name;
        this.defaultBitmap = defaultBitmap;
        this.selectedBitmap = selectedBitmap;
        this.tabType = TabType.BITMAP;
    }

    public TabInfo(String name, Bitmap defaultBitmap, Bitmap selectedBitmap, Color defaultColor, Color tintColor) {
        this.name = name;
        this.defaultBitmap = defaultBitmap;
        this.selectedBitmap = selectedBitmap;
        this.defaultColor = defaultColor;
        this.tintColor = tintColor;
        this.tabType = TabType.BITMAP_TXT;
    }

    public TabInfo(String name, String iconFont, String defaultIconName, String selectedIconName, Color defaultColor, Color tintColor) {
        this.name = name;
        this.iconFont = iconFont;
        this.defaultIconName = defaultIconName;
        this.selectedIconName = selectedIconName;
        this.defaultColor = defaultColor;
        this.tintColor = tintColor;
        this.tabType = TabType.ICON;
    }
}
